package com.sani.study2025.config;

import com.sani.study2025.dto.UserDTO;
import com.sani.study2025.entity.UserEntity;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class UserToDtoConverter implements Converter<UserEntity, UserDTO> {
    public UserDTO convert(UserEntity user) {
        UserDTO userDTO = new UserDTO();
        userDTO.setName(user.getName());
        userDTO.setAge(user.getAge());
        return userDTO;
    }
}